<template>
  <!-- <component :is="comName"></component>中间显示  -->
  <!-- 首先拿到这个页面判断  页面的布局 
1，MyHeader头部组件 分为头部
2， MytabVBar底部区域（里面要用到APP.vue里的数组）
3，Mytable 封装表格（是封装goodlist表格用的）
4.{
  三个动态组件 点击页面当中切换的：{
1，MyeGoodList默认首页
2，Mygoodsearch搜索页面
3，Myuserlnfo用户信息页

  }
}
 -->
  <div>
    <MyHeader :background="'blue'" title="TabBar案例"></MyHeader>
    <div class="main">
      <component :is="uanme"></component>
    </div>
    <MyTabBar :arr="tabList" @chengFn="chengFns"></MyTabBar>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyTabBar from "./components/MyTabBar.vue";
import MyGoodsList from "./views/MyGoodsList.vue";
import MyGoodsSearch from "./views/MyGoodsSearch.vue";
import MyUserInfo from "./views/MyUserInfo.vue";
export default {
  components: {
    MyTabBar,
    MyHeader,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo,
  },
  data() {
    return {
      uanme: "MyGoodsList",
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo",
        },
      ],
    };
  },
  methods: {
    chengFns(index) {
      //  <component :is="uanme"></component>
      //切换动态组件 生明一个变量  变量等于动态组建的索引 
      //  组件等于一个默认的组件

      this.uanme = index;
    },
  },
};
</script>

<style scoped>
.main {
  padding-top: 45px;
  padding-bottom: 51px;
}
</style>